﻿package mortal.game.view.forging.view.compound
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import flash.display.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class CompoundListRender extends GCellRenderer
    {
        private var _txtName:GTextFiled;
        private var _txtStatus:GTextFiled;
        private var _line:ScaleBitmap;

        public function CompoundListRender()
        {
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = new Bitmap();
            this.setStyle("downSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("overSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("selectedOverSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("selectedUpSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._txtName.text = param1.name;
            if (param1.canCompoundNum > 0)
            {
                this._txtName.htmlText = "<font color=\'#1ccc31\'>" + param1.name + "</font>";
                this._txtStatus.htmlText = "<font color=\'#1ccc31\'>(" + param1.canCompoundNum + ")</font>";
            }
            else
            {
                this._txtName.text = param1.name;
                this._txtStatus.htmlText = "";
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.align = TextFormatAlign.CENTER;
            this._txtName = UIFactory.gTextField("", 5, 1, 220, 20, this, _loc_1);
            _loc_1.align = TextFormatAlign.LEFT;
            this._txtStatus = UIFactory.gTextField("", 172, 1, 100, 20, this, _loc_1);
            this._line = UIFactory.bg(0, 20, 220, 1, this, ImagesConst.SplitLine);
            return;
        }// end function

        override public function set selected(param1:Boolean) : void
        {
            var _loc_2:Object = null;
            super.selected = param1;
            if (param1)
            {
                _loc_2 = {data:data.info, index:data.index, maxNum:_data.canCompoundNum};
                Dispatcher.dispatchEvent(new DataEvent(EventName.CompoundInfoSelect, _loc_2));
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._txtName.dispose(param1);
            this._txtName = null;
            this._line.dispose(param1);
            this._line = null;
            this._txtStatus.dispose(param1);
            this._txtStatus = null;
            super.disposeImpl(param1);
            return;
        }// end function

    }
}
